package com.queixate

import javax.servlet.Filter
import javax.servlet.FilterChain
import javax.servlet.ServletResponse
import javax.servlet.ServletRequest
import javax.servlet.FilterConfig
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import groovyx.gaelyk.logging.GroovyLogger


class UsuarioFilter implements Filter {
	
	private FilterConfig filterConfig
	//private GroovyLogger log

	void init(FilterConfig filterConfig) {
		this.filterConfig = filterConfig
		//this.log = new GroovyLogger('gaelyk.usuariofilter')
	}
	
	void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
		HttpServletRequest request = (HttpServletRequest)servletRequest
		HttpServletResponse response = (HttpServletResponse)servletResponse

		def requestURI = request.requestURI
		def method = request.method
		
		
		log.info "filtro de usuario: $requestURI - $method........"

		//response.sendRedirect result.destination
		filterChain.doFilter servletRequest, servletResponse
	}

	void destroy() { }
	
}
	